<form method="post" enctype="multipart/form-data" target="_blank" id="form-order">
    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <thead>
                <tr>
                    <th style="width: 1px;" class="text-center">
                        <!--
                            <input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);">
                        -->
                    </th>
                    <th width = "5%" class="text-center">
                        <a href="javascript:sort('goods_id');">ID</a>
                    </th>
                    <th class="text-center" style=" width: 200px;">
                        <a href="javascript:sort('goods_name');">商品名称</a>
                    </th>
                    <th width = "8%" class="text-center">
                        <a href="javascript:sort('cat_id');">分类</a>
                    </th>
                    <th class="text-center">
                        <a href="javascript:sort('shop_price');">本店售价</a>
                    </th>
                    <th class="text-center">
                        <a href="javascript:sort('is_hot');">热卖推荐</a>
                    </th>
                    <th class="text-center">
                        <a href="javascript:sort('is_new');">新品速递</a>
                    </th>
                    <th class="text-center">
                        <a href="javascript:sort('status');">状态</a>
                    </th>
                    <th width = "5%" class="text-center">
                        <a href="javascript:sort('sort');">排序</a>
                    </th>
                    <th width = "21%" class="text-center">操作</th>
                </tr>
            </thead>
            <tbody>
                <volist name="goodsList" id="list">
                    <tr>
                        <td class="text-center">
                            <!-- <input type="checkbox" name="selected[]" value="6">-->
                            <input type="hidden" name="shipping_code[]" value="flat.flat">
                        </td>
                        <td style="line-height:34px;" class="text-center">{$list.id}</td>
                        <td width="400" style="line-height:34px;" class="text-center">{$list.goods_name|getSubstr=0,33}</td>
                        <td style="line-height:34px;" class="text-center">{$list.goods_cat}</td>
                        <td style="line-height:34px;" class="text-center">{$list.shop_price} </td>
                        <td style="line-height:34px;" class="text-center"><if condition='$list[is_hot] eq 1'><span style="color:#0080FF;">是</span><else />否</if></td>
                        <td style="line-height:34px;" class="text-center"><if condition='$list[is_new] eq 1'><span style="color:#0080FF;">是</span><else />否</if></td>
                        <td style="line-height:34px;" align="center">
                            <img width="20" height="20" src="__PUBLIC__/images/<if condition='$list[status] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('goods', 'id', '{$vo.id}', 'status', this)" />
                        </td>
                        <td style="line-height:34px;" class="text-center">
                            <input type="text" onkeyup="this.value = this.value.replace(/[^\d]/g, '')" onpaste="this.value=this.value.replace(/[^\d]/g,'')" onchange="updateSort('goods', 'id', '{$list.id}', 'ordid', this)" size="4" value="{$list.ordid}" style="text-align:center;line-height:26px;" />
                        </td>
                        <td class="text-left">
                            <a target="_blank" href="{:U('Home/Goods/goodsInfo',array('id'=>$list['id']))}" class="btn btn-info" title="查看详情"><i class="fa fa-eye"></i></a>
                            <a href="{:U('Admin/Goods/addEditGoods',array('id'=>$list['id'],'p'=>$_GET['p']))}" class="btn btn-primary" title="编辑"><i class="fa fa-pencil"></i></a>
                            <a href="javascript:;" onclick="del('{$list[goods_id]}')" class="btn btn-danger" title="删除"><i class="fa fa-trash-o"></i></a>
                            <a href="javascript:;" onclick="clearGoodsHtml('{$list[id]}')" class="btn btn-primary" title="清除静态缓存页面"><i class="fa fa-fw fa-refresh"></i></a>
                            <a href="javascript:;" onclick="clearGoodsThumb('{$list[id]}')" class="btn btn-primary" title="清除缩略图缓存"><i class="glyphicon glyphicon-picture"></i></a>
                        </td>
                    </tr>
                </volist>
            </tbody>
        </table>
    </div>
</form>
<div class="row">
    <div class="col-sm-3 text-left"></div>
    <div class="col-sm-9 text-right">{$page}</div>
</div>
<script>
// 点击分页触发的事件
$(".pagination  a").click(function() {
    cur_page = $(this).data('p');
    ajaxGetTable('search-form2', cur_page);
});
/*
 * 清除静态页面缓存
 */
function clearGoodsHtml(goods_id) {
    $.ajax({
        type: 'GET',
        url: "{:U('Admin/System/clearGoodsHtml')}",
        data: {
            goods_id: goods_id
        },
        dataType: 'json',
        success: function(data) {
            layer.alert(data.msg, {
                icon: 2
            });
        }
    });
}
/*
 * 清除商品缩列图缓存
 */
function clearGoodsThumb(goods_id) {
    $.ajax({
        type: 'GET',
        url: "{:U('Admin/System/clearGoodsThumb')}",
        data: {
            goods_id: goods_id
        },
        dataType: 'json',
        success: function(data) {
            layer.alert(data.msg, {
                icon: 2
            });
        }
    });
}
</script>
